#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main() {
    int n = 1;
    float term = 1.0, sign = 1, sum = 0;
    while (fabs(term) >= 1e-4) {
        sum = sum + term;  
        sign = -sign;     
        term = sign / n;   
        n++;             
    }
    printf("sum=%f\n", sum);
    return 0;
}